<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="cutProcessDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='cutProcessDetail.heading'/>"/>
    <meta name="menu" content="RoleAdminCut"/>

    <script type="text/javascript" src="<c:url value='/scripts/calendar/calendar.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/calendar/lang/calendar-es.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/calendar/calendar-setup.js'/>"></script>
    <script type="text/javascript">
        window.onload = function() {
            Calendar.setup({
                inputField: "endDate",
                ifFormat: "%d/%m/%Y",
                button: "endDate"
            });
        }
       
    </script>
</head>
<div id="help">
    <h2>
        <a href="<c:url value='heplCutProcessFormReview.html?decorate=false'/>"
           title="Help material purchase"
           onclick="Modalbox.show(this.href, {title: this.title, width: 600}); return false;">
               <fmt:message key="help"/>
        </a>
    </h2>
</div>
<table>
<tr>
    <td>
    <s:form id="cutProcessForm" action="saveCutProcessReview" method="post" validate="true">
    <fieldset>
     <legend><fmt:message key="cutProcessForm.selectDatas"/></legend>

        <s:hidden name="cutProcess.id" value="%{cutProcess.id}"/>

        <table class="tableGrey" id="SelectedDatas">
            <thead>
                <tr>
                    <th class="hidden"/>
                    <th><fmt:message key="cutProcess.employee.fullName"/></th>
                    <th><fmt:message key="cutProcess.initDate"/></th>
                    <th><fmt:message key="cutProcess.endDate"/></th>
                    <th><fmt:message key="cutProcess.totalAmount"/></th>
                    <th><fmt:message key="cutProcess.totalAmountFail"/></th>
                    <th><fmt:message key="cutProcess.totalRealAmount"/></th>
                    <th><fmt:message key="cutProcess.totalCurrentAmount"/></th>

                    <th class="hidden"/>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td> <s:property value="cutProcess.employee.fullName" /> </td>
                    <td> <s:property value="cutProcess.initDate" /> </td>
                    <td> <s:textfield id="endDate" key="endDateCutProcess" size="9"/> </td>
                    <td> <s:property value="cutProcess.totalAmount" /></td>
                    <td> <s:property value="cutProcess.totalAmountFail" /></td>
                    <td> <s:property value="cutProcess.totalRealAmount" /></td>
                    <td> <s:property value="cutProcess.totalCurrentAmount" /></td>
                </tr>
            </tbody>
        </table>

        <li class="buttonBar bottom">
            <s:submit cssClass="button" method="saveCutProcessReview" key="button.save" theme="simple"/>
            <s:submit cssClass="button" method="cancel" key="button.cancel" theme="simple"/>
        </li>

    </fieldset>
     </s:form>
</td>
</tr>
</table>
    <div id="divCutDetails">
    <fieldset>

     <legend><fmt:message key="cutProcessForm.tableCutDetail"/></legend>
     <br/>
     <br/>

       <display:table name="listCutDetails" cellspacing="0" cellpadding="0" requestURI=""
                      defaultsort="1" id="listCutDetails" pagesize="25" class="table" >

        <display:column sortable="false" titleKey="cutProcessForm.asignationDetail.editCutDetail" style="width: 10%"
                        autolink="true" media="html" href="editCutDetailReview.html" paramId="id" paramProperty="id">
            <c:if test="${listCutDetails.id != null}">
                <img src="<c:url value="/images/edit.png" />" alt="Edit" />
            </c:if>
        </display:column>

        <display:column property="pantDesign.model.datas" escapeXml="true" sortable="true" titleKey="cutProcessForm.asignationDetail.model" style="width: 20%"/>
        <display:column property="pantDesign.modelSize.valueSize" sortable="true" titleKey="cutProcessForm.asignationDetail.size" style="width: 10%" autolink="true" media="html"/>
        <display:column property="pantDesign.material.description" sortable="true" titleKey="cutProcessForm.asignationDetail.typeMaterial" style="width: 25%" autolink="true" media="html"/>
        <display:column property="quantityGet" sortable="true" titleKey="cutProcessForm.asignationDetail.totalCuts" style="width: 10%" autolink="true" media="html"/>
        <display:column property="priceXclothes" sortable="true" titleKey="cutProcessForm.asignationDetail.priceXclothes" style="width: 10%" autolink="true" media="html"/>
        <display:column property="totalAmountClothes" sortable="true" titleKey="cutProcessForm.asignationDetail.totalAmountClothes" style="width: 20%" autolink="true" media="html"/>


        <display:column property="quantityRealClothes" sortable="true" titleKey="cutProcessForm.asignationDetail.quantityRealClothes" style="width: 20%" autolink="true" media="html"/>

        <display:column property="totalAmount" sortable="true" titleKey="cutProcessForm.asignationDetail.totalAmount" style="width: 20%" autolink="true" media="html"/>

        <%--display:column property="quantityRealClothesCurrent" sortable="true" titleKey="cutProcessForm.asignationDetail.quantityRealClothesCurrent" style="width: 10%" autolink="true" media="html"/--%>
        <%--display:column property="currentAmount" sortable="true" titleKey="cutProcessForm.asignationDetail.currentAmount" style="width: 20%" autolink="true" media="html"/--%>

        <display:setProperty name="paging.banner.all_items_found" value=""/>
        <display:setProperty name="paging.banner.some_items_found" value=""/>
        <display:setProperty name="paging.banner.one_item_found" value=""/>
        <display:setProperty name="paging.banner.no_items_found" value=""/>

    </display:table>
    <c:set var="buttons">
        <input type="button" onclick="location.href='<c:url value="/genJasRepCutProcessReview.html"/>'"
                   value="<fmt:message key="button.reportPDF"/>"/>
    </c:set>
    <c:out value="${buttons}" escapeXml="false" />
    </fielset>
    </div>

     <div id="divPackageUsed">

        <fieldset>

         <legend><fmt:message key="cutProcessForm.packageUsed"/></legend>
         <br/>
         <input type="button" style="margin-right: 5px"
                onclick="location.href='<c:url value="/addPackageDetail.html"/>'"
                value="<fmt:message key="button.add"/>"/>
         <br/>
         <br/>

           <display:table name="listAsignationCuts" cellspacing="0" cellpadding="0" requestURI=""
                          defaultsort="1" id="listCutDetails" pagesize="25" class="table" >

            <display:column sortable="false" titleKey="cutProcessForm.asignationPackageUsed.editPackageUsedRe" style="width: 10%"
                            autolink="true" media="html" href="editPackageDetailRe.html" paramId="idPd" paramProperty="id">
                    <img src="<c:url value="/images/edit.png" />" alt="Edit" />
            </display:column>

            <display:column property="packageDetail.code" sortable="true" titleKey="packageDetail.code" style="width: 10%" autolink="true" media="html"/>
            <display:column property="packageDetail.packageName" sortable="true" titleKey="packageDetail.packageName" style="width: 25%" autolink="true" media="html"/>
            <%--display:column property="packageDetail.quantity" sortable="true" titleKey="packageDetail.quantity" style="width: 10%" autolink="true" media="html"/--%>
            <%--display:column property="packageDetail.stock" sortable="true" titleKey="packageDetail.stock" style="width: 10%" autolink="true" media="html"/--%>
            <%--display:column property="packageDetail.realQuantity" sortable="true" titleKey="packageDetail.realQuantity" style="width: 20%" autolink="true" media="html"/--%>
            <%-- display:column property="packageDetail.quantityCurrentUsed" sortable="true" titleKey="packageDetail.quantityCurrentUsed" style="width: 20%" autolink="true" media="html"/ --%>
            <display:column property="quantityUsed" escapeXml="true" sortable="true" titleKey="asignationCut.quantityUsed" style="width: 20%"/>
            <display:column property="quantityUsedFail" escapeXml="true" sortable="true" titleKey="asignationCut.quantityUsedFail" style="width: 20%"/>
            <display:column property="priceQuantUsedFail" escapeXml="true" sortable="true" titleKey="asignationCut.priceQuantUsedFail" style="width: 20%"/>
            <display:column property="totalQuantUsedFail" escapeXml="true" sortable="true" titleKey="asignationCut.totalQuantUsedFail" style="width: 20%"/>
            <display:column sortable="false" titleKey="cutProcessForm.asignationPackageUsed.deletePackageUsed" style="width: 10%"
                            autolink="true" media="html" href="deletePackageDetail.html" paramId="idPd" paramProperty="id">
                    <img src="<c:url value="/images/trash.png" />" alt="Edit" />
            </display:column>
            <display:setProperty name="paging.banner.all_items_found" value=""/>
            <display:setProperty name="paging.banner.some_items_found" value=""/>
            <display:setProperty name="paging.banner.one_item_found" value=""/>
            <display:setProperty name="paging.banner.no_items_found" value=""/>

        </display:table>

        </fielset>
    </div>

     <div id="divMaterialUsed">

        <fieldset>

         <legend><fmt:message key="cutProcessForm.addMaterials"/></legend>
         <br/>
         <input type="button" style="margin-right: 5px"
                onclick="location.href='<c:url value="/addMaterialCutterUsed.html"/>'"
                value="<fmt:message key="button.add"/>"/>
         <br/>
         <br/>

         <display:table name="listPurchaseDetailCutProcess" cellspacing="0" cellpadding="0" requestURI=""
                          defaultsort="1" id="listPurchaseDetailCutProcess" pagesize="25" class="table" >

            <display:column sortable="false" titleKey="cutProcessForm.editMaterial.editMaterialUsed" style="width: 10%"
                            autolink="true" media="html" href="editMaterialUsedCutProcess.html" paramId="id" paramProperty="id">
                    <img src="<c:url value="/images/edit.png" />" alt="Edit" />
            </display:column>

            <display:column property="purchaseDetail.material.name" sortable="true" titleKey="purchaseDetail.material.name" style="width: 10%" autolink="true" media="html"/>
            <display:column property="quantity" sortable="true" titleKey="asignationCut.quantity" style="width: 25%" autolink="true" media="html"/>
            <display:column property="quantityFail" sortable="true" titleKey="cutDetail.quantityFail" style="width: 10%" autolink="true" media="html"/>
            <display:column property="priceQuantityFail" sortable="true" titleKey="priceQuantityFail" style="width: 10%" autolink="true" media="html"/>
            <display:column property="totalAmountQuantityFail" sortable="true" titleKey="totalAmountQuantityFail" style="width: 10%" autolink="true" media="html"/>
            <display:column sortable="false" titleKey="cutProcessForm.deleteMaterial.deleteMaterialUsed" style="width: 10%"
                            autolink="true" media="html" href="deleteMaterialUsed.html" paramId="id" paramProperty="id">
                    <img src="<c:url value="/images/trash.png" />" alt="Delete" />
            </display:column>
            
            <display:setProperty name="paging.banner.all_items_found" value=""/>
            <display:setProperty name="paging.banner.some_items_found" value=""/>
            <display:setProperty name="paging.banner.one_item_found" value=""/>
            <display:setProperty name="paging.banner.no_items_found" value=""/>

        </display:table>

        </fielset>
    </div>

<script type="text/javascript">
    Form.focusFirstElement($("cutProcessForm"));

    document.getElementById('divCutDetailForm').style.top = document.getElementById('cutProcessForm').offsetTop+"px";
</script>